namespace SinaFinanceBaseClassLibrary
{
    using System;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Media;
    using System.Windows.Shapes;

    public class VolumnColumn : UserControl
    {
        private Color columnColor = Color.FromArgb(0xff, 0, 0xe5, 0xee);
        private double columnHeight = 0.0;
        private double columnSpan = 0.0;
        private double columnWidth = 0.0;
        private int controlZindex = 10;
        public double DEF_COLUMN_HEIGHT = 0.0;
        private int index = 0;
        private double leftSpan = 65.0;
        private Canvas parentCanvas;
        private double topSpan = 20.0;

        public void RenderColumn(ColumnTypeEnum type)
        {
            Rectangle rectangle = new Rectangle {
                Width = this.columnWidth * 0.8,
                Height = this.columnHeight
            };
            if (this.index.Equals(0))
            {
                rectangle.Margin = new Thickness(this.leftSpan + 1.0, (this.TopSpan + this.DEF_COLUMN_HEIGHT) - this.columnHeight, 0.0, 0.0);
            }
            else
            {
                rectangle.Margin = new Thickness((this.leftSpan + 1.0) + (this.index * (this.columnWidth + this.columnSpan)), (this.TopSpan + this.DEF_COLUMN_HEIGHT) - this.columnHeight, 0.0, 0.0);
            }
            rectangle.Fill = new SolidColorBrush(this.columnColor);
            this.parentCanvas.Children.Add(rectangle);
        }

        public Color ColumnColor
        {
            get
            {
                return this.columnColor;
            }
            set
            {
                this.columnColor = value;
            }
        }

        public double ColumnHeight
        {
            get
            {
                return this.columnHeight;
            }
            set
            {
                this.columnHeight = value;
            }
        }

        public double ColumnSpan
        {
            get
            {
                return this.columnSpan;
            }
            set
            {
                this.columnSpan = value;
            }
        }

        public double ColumnWidth
        {
            get
            {
                return this.columnWidth;
            }
            set
            {
                this.columnWidth = value;
            }
        }

        public int ControlZindex
        {
            get
            {
                return this.controlZindex;
            }
            set
            {
                this.controlZindex = value;
            }
        }

        public int Index
        {
            get
            {
                return this.index;
            }
            set
            {
                this.index = value;
            }
        }

        public double LeftSpan
        {
            get
            {
                return this.leftSpan;
            }
            set
            {
                this.leftSpan = value;
            }
        }

        public Canvas ParentCanvas
        {
            get
            {
                return this.parentCanvas;
            }
            set
            {
                this.parentCanvas = value;
            }
        }

        public double TopSpan
        {
            get
            {
                return this.topSpan;
            }
            set
            {
                this.topSpan = value;
            }
        }
    }
}
